import QtQuick 1.0

Item {
    anchors.fill: parent

    signal work

    // NOTE: BusyIndicator not animated when SQL works
    Text {
        id: indicator
        anchors.centerIn: parent
        text: qsTr("Loading...")
        font.pixelSize: visual.fontXlarge
        font.bold: true
        color: visual.colorSecondaryForeground
        visible: false
    }

    Timer {
        id: timer
        interval: 100

        onRunningChanged: {
            if (running)
                indicator.visible = true;
            else
                indicator.visible = false;
        }

        onTriggered: {
            work();
        }
    }

    function start() {
        timer.start();
    }
}
